package com.think.teaching.model;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.think.common.model.Result;
import com.think.common.model.ResultCode;

import java.io.Serializable;

/**
 * <p>
 * 课程标签
 * </p>
 *
 * @author think
 * @since 2020-08-12
 */
public class Tag extends BaseModel<Tag> {

    private static final long serialVersionUID=1L;

    /**
     * 主键
     */
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    /**
     * 标签
     */
    private String tag;

    /**
     * 描述
     */
    private String description;

    /**
     * 标签分类 1课程标签2试题标签3试卷标签4实训标签5文章标签
     */
    private Integer type;

    public static final int COURSE_TAG =1;
    public static final int PAPER_QUESTION_TAG=2;
    public static final int EXAM_PAPER_TAG=3;
    public static final int TRAINING_TAG=4;
    public static final int ARTICLE_TAG=5;
    public static final int NEWS_TAG=6;


    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getTag() {
        return tag;
    }

    public void setTag(String tag) {
        this.tag = tag;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public Integer getType() {
        return type;
    }

    public void setType(Integer type) {
        this.type = type;
    }

    
    @Override
    protected Serializable pkVal() {
        return this.id;
    }

    @Override
    public Result CheckObjectComplete() {
       if(this.getType()>=1&&this.getType()<=6)
           return Result.success();
       else
           return Result.failure(ResultCode.TAG_TYPE_ERROR);
    }

    @Override
    public String toString() {
        return "Tag{" +
        "id=" + id +
        ", tag=" + tag +
        ", description=" + description +
        ", type=" + type +
        ", createdBy=" + createdBy +
        ", createdTime=" + createdTime +
        ", updatedBy=" + updatedBy +
        ", updatedTime=" + updatedTime +
        ", delflag=" + delflag +
        ", state=" + state +
        "}";
    }
}
